import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    name:'login',
    component: () => import('../views/login.vue'),
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home.vue'),
    redirect:'/dashboard',
    children: [
      // 系统首页
      {
        path: '/dashboard',
        name: '',
        component: () => import('@/components/dashboard')
      },
      // 基础表格
      {
        path: '/table',
        name: '',
        component: () => import('@/components/table')
      },
      // tab选项卡
      {
        path: '/tabs',
        name: '',
        component: () => import('@/components/tabs')
      },
      // 详细数据
      {
        path: '/orderInfo',
        name: '',
        component: () => import('@/components/orderInfo')
      },
      //
      //表单相关
      //
      //基本表单
      {
        path: '/form',
        name: '',
        component: () => import('@/components/表单相关/form')
      },
      //三级菜单
      //富文本编辑器
      {
        path: '/editor',
        name: '',
        component: () => import('@/components/表单相关/editor')
      },
      //markdown编辑器
      {
        path: '/markdown',
        name: '',
        component: () => import('@/components/表单相关/markdown')
      },
      //文件上传
      {
        path: '/upload',
        name: '',
        component: () => import('@/components/表单相关/upload')
      },
      //自定义图标
      {
        path: '/icon',
        name: '',
        component: () => import('@/components/icon')
      },
      //添加商品
      {
        path: '/addProduct',
        name: '',
        component: () => import('@/components/addProduct')
      },
      //商品详情
      {
        path: '/productCheck',
        name: '',
        component: () => import('@/components/productCheck')
      },
      //商品修改
      {
        path: '/productEdit',
        name: '',
        component: () => import('@/components/productEdit')
      },
      //schart图表
      {
        path: '/charts',
        name: '',
        component: () => import('@/components/charts')
      },
      //跳转至二级分类
      {
        path: '/secondCategory',
        name: '',
        component: () => import('@/components/secondCategory')
      },
      //添加品类
      {
        path: '/categoryAdd',
        name: '',
        component: () => import('@/components/categoryAdd')
      },
      //
      //拖拽组件
      //
      //拖拽列表
      {
        path: '/drag',
        name: '',
        component: () => import('@/components/拖拽组件/drag')
      },
      //拖拽弹框
      {
        path: '/dialog',
        name: '',
        component: () => import('@/components/拖拽组件/dialog')
      },
      //国际化功能
      {
        path: '/i18n',
        name: '',
        component: () => import('@/components/i18n')
      },
      //
      //错误处理
      //
      //权限测试
      {
        path: '/permission',
        name: '',
        component: () => import('@/components/错误处理/permission')
      },
      //404
      {
        path: '/404',
        name: '',
        component: () => import('@/components/错误处理/404')
      },
      //支持作者
      {
        path: '/donate',
        name: '',
        component: () => import('@/components/donate')
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
